<template>
  <my-nav-bar title="消息">
    <div v-if="this.infoData.length === 0" class="info_page">
      <div class="no_info">
        <van-icon name="chat-o" size="34"/>
        <div>暂无消息</div>
      </div>
    </div>
    <div v-else>
      <van-cell-group>
        <van-cell v-for="(items, index) in infoData"
                  :key="index"
                  title="通知"
                  :value="items.createTime"
                  :label="items.message"
        />
      </van-cell-group>
    </div>
  </my-nav-bar>
</template>

<script>
import MyNavBar from "@/components/MyNavBar";
import {noticeList} from "@/api/notice";
import {
  Cell,
  CellGroup,
  Icon,
} from "vant";

export default {
  name: "Notice",
  components: {
    MyNavBar,
    [Cell.name]: Cell,
    [CellGroup.name]: CellGroup,
    [Icon.name]: Icon,
  },
  data() {
    return {
      infoData: []
    }
  },
  created() {
    noticeList({pageNum: 1, pageSize: 999}).then(res => {
      console.log(res)
      this.infoData = res.data.list
      console.log(this.infoData)
    })


  }
}
</script>

<style scoped>
.info_page{
  padding-top: 125px;
}
.no_info{
  text-align: center;
  font-size: 14px;
  color: #D3D3D3;
}
</style>
